#include<stdio.h>
#include<stdlib.h>

#define N 128

unsigned char buf[N+1];

int main(int argc,char* argv[])
{
    if(argc == 1)
    {
        printf("UNZIP: file1 ...\n");
        exit(1);
    }
    for(int i = 1; i < argc; ++i)
    {
        FILE* fp = fopen(argv[i],"r");
        if(fp == NULL)
        {
            perror("UNZIP");
            exit(1);
        }
        while(fread(buf,1,1,fp) != 0)
        {
            unsigned char ch = buf[0];
            if((ch&0x80) != 0) //重复字符
            {
                int count = (ch&0x7f);
                //printf("重复字符个数：%d\n",count);
                fread(buf,1,1,fp);
                for(int i = 0; i < count; ++i)
                    printf("%c",buf[0]);
                //printf("\n");
            }
            else//非重复字符
            {
                int size = (ch&0x7f);
                //printf("非重复字符个数：%d\n",size);
                fread(buf,size,1,fp);
                for(int i = 0; i < size; ++i)
                    printf("%c",buf[i]);
                //printf("\n");
            }
        }
        fclose(fp);
    }
    return 0;
}